/**
 * @filename:SysUserDao 2025-05-09
 * @project starhub-schema  V1.0
 */
package com.starhub.engine.sys.user.dao;


import com.starhub.engine.sys.user.entity.SysUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;

/**   
 * @Description:(用户设置数据访问层)
 * @version: V1.0
 * @author: luosw
 * 
 */
@Mapper
public interface SysUserDao{

    /**
    *插入所有字段SysUser
    */
    int insert(SysUser record);

    /**
    *插入非空字段SysUser
    *@param record
    */
    int insertSelective(SysUser record);

    /**
    *批量删除SysUser，逻辑删除
    */
    int  deleteSysUserByType(@Param("idList") List<Long> idList,@Param("deleteType") int deleteType);

    /**
    *批量删除SysUser，物理删除
    */
    int  deleteSysUserRecord(@Param("idList") List<Long> idList);

    /**
     *根据SysUser对象,更新记录,仅更新非空字段
     *@param record
     */
     int updateByPrimaryKeySelective(SysUser record);

     /**
     *根据SysUser对象，更新记录
     *@param record
     */
     int updateByPrimaryKey(SysUser record);


    /**
    *根据id，查询SysUser对象
    *@param id 记录id
    */
    SysUser selectByPrimaryKey(@Param("id") Long id);


    /**
    *根据查询条件，查询SysUser对象
    *@param record 记录record
    */
    List<SysUser> selectByPrimaryKeySelective(@Param("record") SysUser record);
    
    /**
     * 统计未删除的用户总数
     * @return 用户总数
     */
    @Select("SELECT COUNT(*) FROM sys_user WHERE delete_type = 0 and status = 'active'")
    Long countActiveUsers();
}